<template>
	<view>
		<!-- <view class="tis_bg">个包裹已发出</view> -->
		<view class="tis_num">
			<view class="tis_line"></view>
			<view class="tis_cont">以下商品被拆成{{ dataList.length }}个包裹</view>
			<view class="tis_line"></view>
		</view>
		<view class="logist_item" @click="goLogistic(item)" v-for="(item, index) in dataList" :key="index">
			<view class="order_top">
				<!-- <view class="state_box">
					<view class="sign iconfont iconfont-e68c"></view>
					<view class="state_name">已签收</view>
				</view> -->
				<view class="logist_basic">{{ item.express_name }}：{{ item.express_no }}</view>
			</view>
			<view class="order_basic">
				<view class="order_no">发货时间：{{item.express_date | formTime}}</view>
				<!-- <view class="order_pay">下单时间：{{item.order_date  | formTime}}</view> -->
			</view>
			<view class="prod_list">
				<image class="prod_item" :src="prodItem.logo" v-for="(prodItem, prodKey) in item.detailed"
					:key="prodIndex"></image>
			</view>
			<view class="total">共{{ item.detailed.length }}件商品</view>
		</view>
	</view>
</template>

<script>
	import {
		formatDate
	} from '@/utils/moment/index.js'
	export default {
		components: {},
		data() {
			return {
				orderId: null,
				dataList: []
			};
		},
		onLoad(options) {
			if (options && options.id) {
				this.orderId = Number(options.id);
				this.$initPage();
			}
		},
		filters: {
			formTime(time) {
				return formatDate(time, 'YYYY-MM-DD HH:mm:ss');
			}
		},
		methods: {
			$initPage() {
				this.$resPost('GetOrderExpressList', {
					pk_id: this.orderId
				}).then(res => {
					res.data[0].detailed = res.data[0].detailed.filter(el => {
						if (el.refund_status == '0' || el.refund_status == 3) {
							return el
						}
					})
					this.dataList = res.data
				});
			},
			goLogistic(item) {
				this.$linkTo(
					`/package/order/logistic?id=${this.orderId}&express_no=${item.express_no}&express=${item.express}&express_name=${item.express_name}`
				);
			}
		}
	};
</script>
<style>
	page {
		background-color: #f5f5f5;
	}
</style>
<style scoped lang="scss">
	.tis_bg {
		background-color: #fef7ed;
		line-height: 64rpx;
		color: #caa56e;
		padding: 0 30rpx;
	}

	.tis_num {
		padding: 18rpx 30rpx;
		display: flex;
		justify-content: center;
		align-items: center;

		.tis_line {
			background-color: #e0e0e0;
			height: 1rpx;
			flex: 1;
		}

		.tis_cont {
			padding: 0 12rpx;
			color: #919191;
		}
	}

	.logist_item {
		margin-bottom: 22rpx;
		background-color: #fff;
		padding: 26rpx 26rpx;

		.order_top {
			display: flex;

			.state_box {
				flex: 1;
				overflow: hidden;
				display: flex;
				align-items: center;

				.sign {
					color: #9f9f9f;
					margin-right: 14rpx;
					font-size: 32rpx;
				}

				.state_name {
					color: #c78a51;
					font-weight: bold;
				}
			}

			.logist_basic {
				display: flex;
				align-items: center;
				color: #999;
			}
		}

		.order_basic {
			margin-top: 16rpx;
			font-size: 22rpx;
			color: #999;
			display: flex;
			align-items: center;
			justify-content: space-between;
		}

		.prod_list {
			margin-top: 16rpx;
			display: flex;
			align-items: center;
			flex-wrap: wrap;

			.prod_item {
				width: 120rpx;
				height: 120rpx;
				margin-right: 14rpx;
			}
		}

		.total {
			color: #999;
			margin-top: 16rpx;
		}
	}
</style>
